<%-- 
    Document   : show-product-by-manufacturer-box
    Created on : 04-05-2011, 15:52:51
    Author     : DoanHa
--%>

<%@page import="com.vienthona.common.utils.ProductUtils"%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="java.util.List"%>
<%@page import="com.vienthonga.hibernate.pojo.TProduct"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>





<%
            List<TProduct> mobilePhones = (List<TProduct>) request.getAttribute("mobilePhones");
            int NumberOfPage = (Integer) request.getAttribute("NumberOfPage");
            String manufacturerID = request.getAttribute("S_ID").toString();
            DecimalFormat format = new DecimalFormat("##,###,###");
%>
<div id="content">



    <div class="box_2">
        <div class="header Boxtitle_2">
            <span><center><b>Chi Tiết Sản Phẩm</b></center>
            </span>
        </div>
        <div class="content">
            <div class="childContent">
                <table cellspacing="0" border="1" style="border-collapse: collapse" width="100%">
                    <%
                                for (int i = 0; i < mobilePhones.size(); i++) {
                                    TProduct mobilePhone = mobilePhones.get(i);


                    %>
                    <tr>
                        <td align="center" width="20%">
                            <a class="image" href="./ShowMobilephoneDetail.do?P_ID=<%= mobilePhone.getPId()%>" >
                                <input id="p_ID" value="<%= mobilePhone.getPId()%>" type="hidden"/>
                                <img src="<%= ProductUtils.getImagePath(mobilePhone.getPPhotos(), 0)%>" alt="<%= mobilePhone.getPName()%>" height="140" width="80"/>
                            </a>
                        </td>
                        <td valign="top" width="60%">
                            <div class="productInfo">
                                <span> <%= mobilePhone.getPName()%> </span>
                                <br>
                                <br>
                                <p><%= mobilePhone.getPDesc()%></p>

                            </div>
                            <div class="productInfo_button">
                                <span> <%= format.format(mobilePhone.getPUnitPrice())%> VND </span>
                                <a href="./ShowMobilephoneDetail.do?P_ID=<%= mobilePhone.getPId()%>" ><img height="19" width="71" style="border:0px;" src="images/xemchitiet_but.gif" alt=""></a>
                                <a href="" ><img style="border:0px;padding-right:5px;" src="images/dathang_but.gif" alt=""></a>
                            </div>
                        </td>

                    </tr>
                    <%
                                }
                    %>
                </table>
                <div class="PagesFlickr">
                    <div class="Paginator">

                        <%
                                    for (int i = 0; i < NumberOfPage; i++) {
                        %>
                        <a href="ShowMobilephoneByManufacturer.do?S_ID=<%=manufacturerID%>&page=<%= i + 1%>"><%= i + 1%></a>
                        <%                                }
                        %>

                    </div>

                </div>
            </div>
        </div>
    </div>


</div>
<script type="text/javascript" src="js/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="js/jquery.tooltip.js" ></script>
<script type="text/javascript" >
    $("document").ready( function() {

        $(".image").tooltip( {
        track: true,
        delay: 0,
        showURL: false,
        opacity: 1,
        fixPNG: true,
        showBody: " - ",
        extraClass: "pretty",
        top: -15,
        left: 20,
            bodyHandler: function(){
                var p_ID = $(this).children('input').attr('value');
             //var p_ID = 'PHTC0001';
              var msgTemp ;
              var sendData = "P_ID=" + p_ID;
              $.ajax({
                 type: "GET",
                 url: "./ShowProductTooltip.do",
                 data: sendData ,
                 async: false,
                 success: function(msg)
                 {
                    msgTemp = msg;
                 }
                 
              }); //end ajax

              if(msgTemp != undefined)
              {
             
                var str = "<table width='350' height='120' border='0' cellspacing='0' cellpadding='0'> <tr> <td height='20' align='center' bgcolor='#000000' style='color:#FFF' > <strong>Tính Năng Nổi Bật<\/strong> <\/td> <\/tr> ";
                str += "<tr> <td> <strong>Màn hình<\/strong>:"+ msgTemp.display.displayType +"; "+ msgTemp.display.displaySize +"<\/td> <\/tr>"
                str += "<tr> <td> <strong>Bộ Nhớ<\/strong>:"+msgTemp.storage.contact +"; "+msgTemp.storage.internalMemory +"; "+msgTemp.storage.externalMemory +"<\/td> <\/tr>"
                str += "<tr> <td><strong>Nhạc chuông<\/strong>:"+ msgTemp.orthers.musicDownload +"; "+msgTemp.orthers.ring_2 +"<\/td> <\/tr>"
                str += "<tr> <td><strong>Hệ Điều Hành:<\/strong>:"+ msgTemp.orthers.os +"<\/td> <\/tr>"
                str += "<\/table>";
                return  $(str);
              }
              return "";

            } // end body handler
        }); 

    });
</script>